package com.huaxin.hxmoduleworkorder.models;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.huaxin.hxmoduleworkorder.common.enums.MaintenanceOrderElectricianTaskOperation;
import com.huaxin.hxmoduleworkorder.common.enums.MaintenanceOrderElectricianTaskStatus;
import com.huaxin.hxmoduleworkorder.common.enums.MaintenanceOrderOperatorRole;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

@Data
@TableName("maintenance_order_electrician_process")
@EqualsAndHashCode(callSuper = true)
public class MaintenanceOrderElectricianTaskProcess extends BaseModel {
    @TableField(value = "maintenance_order_id")
    @Schema(description = "维修工单ID", example = "mnt_order_001")
    private String maintenanceOrderId;

    @TableField(value = "maintenance_order_electrician_task_id")
    @Schema(description = "工单电工任务ID", example = "mnt_order_electrician_task_001")
    private String maintenanceOrderElectricianTaskId;

    @TableField(value = "action")
    @Schema(description = "执行的动作：accept/reject/on-site/start_process/resolve/view", example = "accept")
    private MaintenanceOrderElectricianTaskOperation action;

    @TableField(value = "from_status")
    @Schema(description = "变更前状态：assigned/accepted/on-site/processing/resolved/rejected/cancelled", example = "assigned")
    private MaintenanceOrderElectricianTaskStatus fromStatus;

    @TableField(value = "to_status")
    @Schema(description = "变更前状态：assigned/accepted/on-site/processing/resolved/rejected/cancelled", example = "assigned")
    private MaintenanceOrderElectricianTaskStatus toStatus;

    @TableField(value = "operator_Id")
    @Schema(description = "操作者ID", example = "admin")
    private String operatorId;

    @TableField(value = "operator_role")
    @Schema(description = "操作者角色：customer/admin/electrician", example = "admin")
    private MaintenanceOrderOperatorRole operatorRole;

    @TableField(value = "operator_longitude")
    @Schema(description = "操作者经度", example = "116.397128")
    private String operatorLongitude;

    @TableField(value = "operator_latitude")
    @Schema(description = "操作者纬度", example = "39.915119")
    private String operatorLatitude;

    @TableField(value = "remarks")
    @Schema(description = "备注（如审核意见、处理说明）", example = "已分配给张师傅")
    private String remarks;

    @TableField(value = "is_completed")
    @Schema(description = "该步骤是否完成", example = "1")
    private Integer isCompleted;

    @TableField(value = "next_step_due_time")
    @Schema(description = "下一步预计完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime nextStepDueTime;
}


